@MineTin:
GoToIfBagFull(@GoToSmelt)
GoToIfCountInInventoryGreater(@MineCopper,13,202)
Action(308,640)
AtObject(308,641)
Wait(8)
GoTo(@MineTin)
@MineCopper:
Action(310,636)
AtObject(310,635)
Wait(27)
Action(310,636)
AtObject(311,636)
Wait(27)
GoToIfBagFull(@GoToSmelt)
GoToIfLastServerMessageIs(@GoToSmelt,"@gam@You are too tired to mine this rock")
GoTo(@MineCopper)

@GoToSmelt:

MoveTo(306,636)
MoveTo(305,619)
MoveTo(305,614,-8,-8)
MoveTo(297,596,1,-1)
MoveTo(298,592,-8,-8)
MoveTo(290,578,3,-3)

SetVarFatigue(%t)
GoToIfVarBelowNum(@StraightToBank,%t,700)

--MoveTo(296,575,1,1)
--MoveTo(297,578)
----- sleep
@GetSomeSleep:
UseItem(0)
ResetLastServerMessage()
SetVarNum(%secs,0)
@JustWait:
Wait(10)
AddVarNum(%secs,1)
GoToIfVarAboveNum(@GetSomeSleep,%secs,70)
GoToIfLastServerMessageIsNot(@JustWait,"You wake up - feeling refreshed")
SetVarNum(%times,0)


--MoveTo(297,577)
--MoveTo(297,575)
--MoveTo(297,570,-1,-1,-1,-7,-5,-11)
@StraightToBank:
MoveTo(292,558,5,-5,6,-5,12,-11)
MoveTo(304,545,1,-1)
MoveTo(308,544)



@Smelt:
GoToIfCountInInventoryGreater(@HaveTin,0,202)
GoTo(@GoToBank)
@HaveTin:
GoToIfCountInInventoryGreater(@HaveCopper,0,150)
GoTo(@GoToBank)
@HaveCopper:
Action(306,545)
AtObjectWithItemByID(306,546,202)
Wait(32)
GoTo(@Smelt)

@GoToBank:
MoveTo(306,544)
MoveTo(304,544)
MoveTo(304,545,-11,11)
MoveTo(293,568,-4,4)
MoveTo(285,572,-1,-1)

----- Banking stuff
@Banking:
GoToIfCoordsIn(@AmInsideBank,286,573,280,564)
GoTo(@GoInsideBank)

@AmInsideBank:
GoToIfNPCNear(@ISeeBanker,95)

--- WTF - no bankers visible?
--- maybe we should leave this screen
--- and come back again
Debug("I don't see any bankers here!")
MoveTo(286,571,1,0,1,-11,7,-17)
MoveTo(293,553,9,-9)
MoveTo(302,548,-5,5,-5,6,-12,13)
MoveTo(290,568,-3,3,-4,3,-8,-1)
GoTo(@Banking)

; Talk to the nearest banker every time
@ISeeBanker:
ResetQuestMenu()
SetVarsRandomNPCIn(%x,%y,%ID,286,573,280,564,95)
ActionVarVar(%x,%y)
TalkToNPCVar(%ID)
WaitForQuestMenu(30)
GoToIfQuestMenu(@ContactWithBanker)
GoTo(@Banking)

@ContactWithBanker:
Answer(0)
WaitForBankWindow(50)
Wait(5)
DepositEverything()
Wait(15)
CloseBank()
GoToIfInInventory(@Banking,169)

-- Leave the bank and go mining

MoveTo(286,571)
MoveTo(288,571)
MoveTo(288,578,2,2,2,5,3,6)
MoveTo(291,588,9,9)
MoveTo(300,603)
MoveTo(300,604,5,5)
MoveTo(305,625,-1,1)
MoveTo(304,631,1,1,1,4,4,7)



GoTo(@MineTin)

@GoInsideBank:
MoveTo(288,571)
MoveTo(283,571,-2,-2)
GoTo(@Banking)
